import 'package:app_settings/app_settings.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sports_new/resources/colours.dart';
import 'package:sports_new/utils/utils.dart';
import 'package:sports_new/widgets/base/qkd_button.dart';

import 'base/qkd_text.dart';

class OpenNotificationDialog extends StatelessWidget {
  // final VoidCallback? onAgree;
  const OpenNotificationDialog({super.key});

  @override
  Widget build(BuildContext context) {
    return Dialog(
      shape: const RoundedRectangleBorder(
          borderRadius: BorderRadius.all(Radius.circular(10))),
      child: WillPopScope(
        onWillPop: () async => false,
        child: Container(
          padding: const EdgeInsets.fromLTRB(16, 16, 16, 24),
          width: 280,
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Row(
                children: [
                  GestureDetector(
                    child: Image.asset(
                      Utils.getImgPath('close.png'),
                      width: 24,
                    ),
                    onTap: () {
                      Get.back();
                    },
                  ),
                ],
              ),
              Image.asset(
                Utils.getImgPath('open_push_hint.png'),
                width: 180,
                height: 132,
              ),
              const SizedBox(height: 18),
              QkdText('打开推送消息',
                fontWeight: FontWeight.w500, fontSize: 16
              ),
              const SizedBox(height: 8),
              QkdText('及时获取专家的最新方案', color: Colours.grey66),
              const SizedBox(height: 20),
              QkdButton.large(
                onPressed: () {
                  AppSettings.openAppSettings(type: AppSettingsType.notification);
                  Get.back();
                },
                text: '前往开启',
                height: 44,
                // minWidth: double.infinity,
                borderRadius: 4,
                foregroundColor: Colours.white,
                backgroundColor: Colours.main,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
